<template>
  <!-- 正式菜单从后端接口读取数据,开发时暂时写入死数据 -->
  <div style="height: 100%">
    <div style="height: 90%">
      <el-menu
        :unique-opened="true"
        class="el-menu-vertical-demo"
        background-color="#191919"
        text-color="#303133"
        active-text-color="#409EFF"
      >
        <el-menu-item class="icon">
          <a href="#/admin/index">
            <i class="el-icon-s-home"></i>
          </a>
        </el-menu-item>
        <el-menu-item class="icon">
          <a href="#/admin/myinfo/myindex">
            <i class="el-icon-user"></i>
          </a>
        </el-menu-item>
        <el-menu-item class="icon">
          <!-- <a href="#" onclick="goToGoods()"> -->
          <a href="#/admin/goods/goodsindex">
            <i class="el-icon-s-shop"
              style="margin-top: 10px"></i>
          </a>
        </el-menu-item>
      </el-menu>
    </div>
    <div class="dropdown" @click="changeIsShow()">
      <el-avatar
        src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" class="dropbtn"
      ></el-avatar>
			<div class="dropdown-content" v-show="isShow">
			  <a href="#/admin/myinfo/auditinfo">个人信息</a>
        <a href="#/login" @click="signout">注销</a>
      </div>
    </div>
  </div>
</template>

<script>
import { postSignout } from "crm/login/login.js";
export default {
  name: "Side",
  data() {
    return {
      isShow:false,
    };
  },
  beforeMount() {},
  methods: {
    // goToGoods() {
    //   this.$router.push({
    //     name: "/admin/goods/goodsindex",
    //   });
    // },
    changeIsShow(){
      this.isShow=true
    },
    // 注销
    signout(){
      let payload = {};
      payload.userid = localStorage.getItem("userid");
      postSignout(payload)
        .then((res) => {
          if (res.data.status == "OK") {
            alert("注销成功！");
            console.log("注销成功！");
            console.log(res.data.data.userid);
            this.$router.push("#/login");
          }
        })
        .catch((err) => {});
      // }
      // });
    },
  },
};
</script>

<style scoped>
.el-menu-vertical-demo {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.el-menu {
  border-right: solid 1px #191919;
}
.el-avatar {
  height: 60px;
  width: 60px;
  position: relative;
  top:25%
}
.icon {
  width: 50px;
  height: 80px;
}
.icon i {
  font-size: 40px;
  margin-left: -10px;
}
.dropdown{
  position: relative;
  display: inline-block;
}
.dropdown-content{
  display: none;
  float: right;
  position: absolute;
  background-color: #191919;
  min-width: 160px;
  box-shadow:  0px 8px 16px 0px rgba(0,0,0,0.2);
  bottom: 10px;
  left: 60px;
  z-index: 10;
}
.dropdown-content a{
  font-family: 'Youshebiaotihei';
  color: #505050;
  font-size: 25px;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}
.dropdown-content a:hover{background-color: #f1f1f1}
.dropdown:hover .dropdown-content{
  display: block;
}
.dropdown:hover .dropbtn{
  background-color: #f1f1f1;
}
</style>